<template>
  <view>
    <view @click="toggleNode(item)">{{ item.address_hide }}</view>
    <view v-if="item.children && item.children.length && item.expanded">
      <tree-item v-for="child in item.children" :key="child.id" :item="child"></tree-item>
    </view>
  </view>
</template>

<script>
  export default {
    name: 'TreeItem',
    props: ['item'],
    data() {
      return {
        expanded: false // 初始状态为折叠
      };
    },
    methods: {
      toggleNode(e) {
		console.log(e)
		this.$emit('switchFold',e)
		this.$forceUpdate()
      }
    }
  }
</script>